//package leetcode;
//
//
//class Student implements Cloneable {
//    private String name;
//
//    public String getName() {
//        return name;
//    }
//
//    public void setName(String name) {
//        this.name = name;
//    }
//
//    @Override
//    public String toString() {
//        return "Student{" +
//                "name='" + name + '\'' +
//                '}';
//    }
//
//    @Override
//    protected Object clone() throws CloneNotSupportedException {
//        return super.clone();
//    }
//}
//
//class Teacher implements Cloneable {
//    private String name;
//    private Student student;
//
//    public String getName() {
//        return name;
//    }
//
//    public void setName(String name) {
//        this.name = name;
//    }
//
//    public Student getStudent() {
//        return student;
//    }
//
//    public void setStudent(Student student) {
//        this.student = student;
//    }
//
//    @Override
//    public String toString() {
//        return "Teacher{" +
//                "name='" + name + '\'' +
//                ", student=" + student +
//                '}';
//    }
//
//    @Override
//    protected Object clone() throws CloneNotSupportedException {
//        return super.clone();
//    }
//}
//
//public class Test3 {
//    public static void main(String[] args) throws CloneNotSupportedException {
//        Student zhangsan_stu = new Student();
//        zhangsan_stu.setName("张三");
//
//        Teacher wang_teacher = new Teacher();
//        wang_teacher.setName("王");
//        wang_teacher.setStudent(zhangsan_stu);
//
//        System.out.println(zhangsan_stu);
//        System.out.println(wang_teacher);
////        Student{name='张三'}
////        Teacher{name='王', student=Student{name='张三'}}
//
//        Teacher zhao_teacher = new Teacher();
//        zhao_teacher = (Teacher) wang_teacher.clone();
//        System.out.println(zhao_teacher);
////        赵老师拷贝王老师
////        Teacher{name='王', student=Student{name='张三'}}
//        zhao_teacher.setName("赵");
//        zhao_teacher.getStudent().setName("李四");
//        System.out.println(wang_teacher);
//        System.out.println(zhao_teacher);
////        Teacher{name='王', student=Student{name='李四'}} 原始数据被修改成了李四，证明是浅拷贝
////        Teacher{name='赵', student=Student{name='李四'}}
//    }
//}
